//
//  GRTopSearchReusableView.m
//  YC_GRice
//
//  Created by LiuFeng on 2018/7/13.
//  Copyright © 2018年 YeCai. All rights reserved.
//

#import "GRTopSearchReusableView.h"

@implementation GRTopSearchReusableView

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


- (void)topTitleAtIndexPath:(NSInteger)section count:(NSInteger)count {
    if (section == 0) {
        _textLabel.text   = @"热门搜索";
        _noRecord.hidden  = YES;
        _deleteBtn.hidden = YES;
    }else {
        _textLabel.text   = @"历史记录";
        _noRecord.hidden  = count == 0 ? NO : YES;
        _deleteBtn.hidden = count == 0 ? YES : NO;
        _textLabel.textColor = HEXCOLOR(0x999999);
    }
}

- (IBAction)deleteAllRecord:(id)sender {
    [[HistoryManager shareHistory] deleteTableOfName:tableName];
    if ([self.delegate respondsToSelector:@selector(deleteAllHistorys)]) {
        [self.delegate deleteAllHistorys];
    }
}



@end
